<?
require_once('Validator.php');
require_once('ValidatorException.php');

abstract class ValidatorBase implements Validator {
	abstract protected function doValidate($value);

	private $msg;

	public function setErrorMessage($msg) { $this->msg= $msg; return $this; }
	public function getErrorMessage() { return $this->msg; }

	public function validate($value) {
		if (is_null($value)) return;
		return $this->doValidate($value);
	}
}
